package com.qf;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisPoolUtils {
    private static JedisPool jedisPool;

    static {
        //创建连接池
        JedisPoolConfig config = new JedisPoolConfig();
        //设置连接池最小连接数
        config.setMaxIdle(5);
        //设置连接池最大连接数
        config.setMaxTotal(10);
        //等待超时时间
        config.setMaxWaitMillis(5000);

        jedisPool = new JedisPool(config,"192.168.247.203",6379);
    }

    public static Jedis getJedis(){
        return jedisPool.getResource();
    }
}
